<script>

export default {
  name: "MyStudent",
  data() {
    return {
      name: "张三",
      age: 18
    }
  },
  methods:{
    sendStudentName(){
      this.$emit("getStudentName",this.name,6666,88888,this.age)
    }
  }
}
</script>

<template>
  <div class="student">
    <h2>学生姓名:{{ name }}</h2>
    <h2>学生年龄:{{ age }}</h2>
    <button @click="sendStudentName">发送学生姓名</button>
  </div>
</template>


<style scoped>
.student {
  background-color: red;
  padding: 5px;
  margin-top: 30px;
}
</style>